import torch
from perceptron_model import Perceptron
from net_model import Net

# 加载单层感知机模型
perceptron_model = Perceptron()
perceptron_model.load_state_dict(torch.load("perceptron_model.pth"))
print("perceptron model structure:")
print(perceptron_model)

# 测试单层感知机模型
test_input = torch.tensor([[10.0]])
perceptron_model.eval()
with torch.no_grad():
    test_output = perceptron_model(test_input)
print("Test input: 10.0, Test output:", test_output.item())

# 加载多层感知机模型
net_model = Net()
net_model.load_state_dict(torch.load("net_model.pth"))
print("net model structure:")
print(net_model)

# 测试多层感知机模型
net_model.eval()
with torch.no_grad():
    test_output = net_model(test_input)
print("Test input: 10.0, Test output:", test_output.item())